// /* **********************************************************************************
//  *
//  * Copyright (c) Sky Sanders. All rights reserved.
//  * 
//  * This source code is subject to terms and conditions of the Microsoft Public
//  * License (Ms-PL). A copy of the license can be found in the license.htm file
//  * included in this distribution.
//  *
//  * You must not remove this notice, or any other, from this software.
//  *
//  * **********************************************************************************/
using System.Collections.Generic;
using SimpleRemoteControl.Configuration;
using SimpleRemoteControl.Data.Domain;

namespace SimpleRemoteControl.Data.Repositories
{
    public static class BrowserRepository
    {
        public static Browser GetByKey(string key)
        {
            return Map(Common.Config.Browsers[key]);
        }

        public static List<Browser> Get()
        {
            List<Browser> result = new List<Browser>();
            Common.Config.BrowserList.ForEach(b => result.Add(Map(b)));
            return result;
        }

        private static Browser Map(BrowserElement el)
        {
            Browser result = new Browser
                                 {
                                     Description = el.Description,
                                     Key = el.Key,
                                     Name = el.Name,
                                     Path = el.Path,
                                     Version = el.Version
                                 };
            return result;
        }
    }
}